package map;

import java.util.HashMap;
import java.util.Map;

/**
 * Map 查找表
 */
public class MapDemo {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();

        Integer value = map.put("历史",34);
        System.out.println(value);
        map.put("语文",11);
        map.put("数学",12);
        map.put("英语",14);
        map.put("化学",15);
        map.put("物理",16);
        System.out.println(map);

        value = map.put("历史",90);
        System.out.println(map);
        System.out.println(value);
        int size = map.size();
        System.out.println(size);

        value = map.get("英语");
        System.out.println("ying:"+value);
        value = map.get("体育");
        System.out.println("ti:"+value);

        value = map.remove("语文");
        System.out.println(value);
        System.out.println(map);

        boolean ck = map.containsKey("数学");
        boolean cv = map.containsValue(81);
        System.out.println("包含key:"+ck);
        System.out.println("包含value:"+cv);

        map.clear();
        System.out.println(map);
    }
}
